# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2023-06-07
desc: 
sample: 
"""
# 关联
testlist = [{'caseName': '测试1', 'order': 2, '开启': '是'}, {'caseName': '测试2', 'order': 1, '开启': '是'},
            {'caseName': '测试3', 'order': 4, '开启': '否'}, {'caseName': '测试4', 'order': 3, '开启': '是'}]


def test():
    print("1")

# 过滤
def filterFun(ele):
    return ele['开启'] == '是'


filterlist = list(filter(filterFun, testlist))
print(filterlist)

# 排序规则函数
# def orderfun(ele):
#      return ele['order']
#
# filterlist.sort(key=orderfun)
# print(filterlist)

# lambda
filterlist = list(filter(lambda x: x['开启'] == '是', testlist))

filterlist.sort(key=lambda x: x['order'], reverse=True)
